ccopts=$(shell perl -MExtUtils::Embed -e ccopts ) 
ldopts=$(shell perl -MExtUtils::Embed -e ldopts )
INC=-fPIC -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux

basename=Bioteampl


all:test

test:lib test.c
	@echo ----------------------------------
	@echo ------------compiling and run test 
	gcc -o test -L./ -lbioteampl test.c
	export LD_LIBRARY_PATH=. && ./test
	@echo ----------------------------------
	@echo ----------------------------------
lib:libbioteampl.so

libbioteampl.so:$(basename).o $(basename)_wrap.o
	gcc -s $(basename).o $(basename)_wrap.o $(ldopts) -shared -Wl,-soname,libbioteampl.so -o libbioteampl.so
.c.o:
	gcc -c $(INC) $(ccopts) $<
swig:$(basename)_wrap.c

$(basename)_wrap.c:$(basename).i
	swig -java -package  net.bioteam.perl5 $(basename).i
	mv *.java ../src/net/bioteam/perl5
clean:
	rm -f *.o *.so *~  test



